﻿
// TestDlg.cpp: 实现文件
//

#include "pch.h"
#include "framework.h"
#include "Test.h"
#include "TestDlg.h"
#include "afxdialogex.h"
#include "VFAdapterAPIs.h"  //引用VFAdapter头文件
#include <vector>
#include <string>

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

#pragma comment(lib, "VFAdapter.lib") //加载lib文件

// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
	CAboutDlg();

// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_ABOUTBOX };
#endif

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

// 实现
protected:
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()

//BSTR转CString
CString ConvertBSTRToCString(BSTR ibstr)
{
	CString strDest;
	if (ibstr != NULL)
	{
		int nLength = ::SysStringLen(ibstr); // 获取字符串长度（以字为单位）
		strDest.GetBuffer(nLength + 1);
		::memcpy(strDest.GetBuffer(), ibstr, (nLength + 1) * sizeof(TCHAR));
		strDest.ReleaseBuffer();
		SysFreeString(ibstr);
	}
	return strDest;
}
//CString转BSTR
BSTR ConvertCStringToBSTR(CString istr)
{
	BSTR bstrDest = SysAllocStringLen(istr.GetBuffer(), istr.GetLength());
	if (bstrDest != NULL)
	{
		// 复制字符串内容
		::memcpy(bstrDest, istr.GetBuffer(), (istr.GetLength() + 1) * sizeof(TCHAR));
	}
	return bstrDest;
}
// CTestDlg 对话框

void ConvertRealValueToCString(double idValue,CString& ostr)
{
	if (abs(idValue) < 0.001)
	{
		ostr = "0";
		return;
	}
	ostr.Format(_T("%lf"), idValue);
}


CTestDlg::CTestDlg(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_TEST_DIALOG, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CTestDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}
const char* ConvertCStringToConstChar(CString istr)
{
	const char* cstr;
	char* temp = new char[100];
	::wsprintfA(temp, "%ls", (LPCTSTR)istr);
	cstr = temp;
	return cstr;
}
BEGIN_MESSAGE_MAP(CTestDlg, CDialogEx)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDOK, &CTestDlg::OnBnClickedOk)
	ON_BN_CLICKED(btnConnect, &CTestDlg::OnBnClickedbtnconnect)
	ON_BN_CLICKED(btnClearAll, &CTestDlg::OnBnClickedbtnclearall)

	ON_BN_CLICKED(btn1, &CTestDlg::OnBnClickedbtnCurveLength)
	ON_BN_CLICKED(btn2, &CTestDlg::OnBnClickedbtnCreatePointByProjection)
	ON_BN_CLICKED(btn3, &CTestDlg::OnBnClickedbtnCreateSplitOrTrim)
	ON_BN_CLICKED(btn4, &CTestDlg::OnBnClickedbtnCreatPointByGeodesicDis)
	ON_BN_CLICKED(btn5, &CTestDlg::OnBnClickedbtnGetIntersectCurve)
	ON_BN_CLICKED(btn6, &CTestDlg::OnBnClickedbtnGeodesicLengthOfPointToCurve)
	ON_BN_CLICKED(btn7, &CTestDlg::OnBnClickedbtnGetUnitTangentVectorAtPoint)
	ON_BN_CLICKED(btn8, &CTestDlg::OnBnClickedbtnGetUnitNormalVectorAtPoint)
	ON_BN_CLICKED(btn9, &CTestDlg::OnBnClickedbtnGetPointByGeodesicDis2)
	ON_BN_CLICKED(btn10, &CTestDlg::OnBnClickedbtnCreatPointByGeodesicDis2)
	ON_BN_CLICKED(btn11, &CTestDlg::OnBnClickedbtntypegetid)
	ON_BN_CLICKED(btn12, &CTestDlg::OnBnClickedbtnTestPointOnSurfaceByProject)
	ON_BN_CLICKED(btn13, &CTestDlg::OnBnClickedbtnCreateNormalLineAndArrowhead)
	ON_BN_CLICKED(btn14, &CTestDlg::OnBnClickedbtnDeleteNormalLineAndArrowhead)
	ON_BN_CLICKED(btnTest, &CTestDlg::OnBnClickedbtntest)

END_MESSAGE_MAP()


// CTestDlg 消息处理程序

BOOL CTestDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// 将“关于...”菜单项添加到系统菜单中。

	// IDM_ABOUTBOX 必须在系统命令范围内。
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != nullptr)
	{
		BOOL bNameValid;
		CString strAboutMenu;
		bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
		ASSERT(bNameValid);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}
	// 设置此对话框的图标。  当应用程序主窗口不是对话框时，框架将自动
	//  执行此操作

	vector<LPCTSTR> vectStrName;
	vectStrName.push_back(_T("曲线长度"));
	vectStrName.push_back(_T("建投影点"));
	vectStrName.push_back(_T("修剪曲线"));
	vectStrName.push_back(_T("求曲面点"));
	vectStrName.push_back(_T("相交线组"));
	vectStrName.push_back(_T("测地距离"));
	vectStrName.push_back(_T("切向量"));
	vectStrName.push_back(_T("法向量"));
	vectStrName.push_back(_T("曲面点坐标"));
	vectStrName.push_back(_T("创建曲面点坐标"));
	vectStrName.push_back(_T("拾取"));
	vectStrName.push_back(_T("点是否在曲面内"));
	vectStrName.push_back(_T("法向箭头"));
	vectStrName.push_back(_T("删除法向箭头"));

	SetButtonName(vectStrName);
	SetButtonVisible(vectStrName.size());
	SetButtonsState(false);


	return TRUE;  // 除非将焦点设置到控件，否则返回 TRUE
}

void CTestDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialogEx::OnSysCommand(nID, lParam);
	}
}

// 如果向对话框添加最小化按钮，则需要下面的代码
//  来绘制该图标。  对于使用文档/视图模型的 MFC 应用程序，
//  这将由框架自动完成。

void CTestDlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // 用于绘制的设备上下文

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// 使图标在工作区矩形中居中
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// 绘制图标
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialogEx::OnPaint();
	}
}

//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CTestDlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}

CStringArray* GetSplitString(CString istr,CString istrSplit)
{
	CStringArray* arrayRes = new CStringArray;
	while (true)
	{
		int index = istr.Find(istrSplit);
		if (index == -1)
		{
			arrayRes->Add(istr);
			return arrayRes;
		}
		CString strTest1 = istr.Left(index);
		arrayRes->Add(strTest1);
		istr = istr.Right(istr.GetLength() - index - 1);
	}
}
int* GetSplitListInt(CString istr, CString istrSplit = _T(","))
{
	CStringArray* arrayString = GetSplitString(istr, istrSplit);
	int nSize = arrayString->GetSize();
	int* nlist = new int(nSize + 1);
	for (int n = 0; n < nSize; n++)
	{
		nlist[n] = _ttoi(arrayString->GetAt(n));
	}
	return nlist;
}
double* GetSplitListDouble(CString istr, CString istrSplit = _T(","))
{
	CStringArray* arrayString = GetSplitString(istr, istrSplit);
	int nSize = arrayString->GetSize();
	double* dlist = new double();
	for (int n = 0; n < nSize; n++)
	{
		dlist[n] = _ttof(arrayString->GetAt(n));
	}
	dlist[nSize] = NAN;
	return dlist;
}
const char** GetSplitListCC(CString istr, CString istrSplit = _T(","))
{
	vector<const char*> vectStr;
	CStringArray* arrayString = GetSplitString(istr, istrSplit);
	for (int n = 0; n < arrayString->GetSize(); n++)
	{
		vectStr.push_back(ConvertCStringToConstChar(arrayString->GetAt(n)));
	}

	const char** listCStr = new const char* [vectStr.size()];
	for (int n = 0; n < vectStr.size(); n++)
	{
		listCStr[n] = vectStr[n];
	}
	//默认数组后面加nullptr
	listCStr[vectStr.size()] = nullptr;
	return listCStr;
}
CString GetResultString(const char** ccResult)
{
	CString cstrResult1;
	const char** temp1 = ccResult;
	while (!!*temp1) {
		cstrResult1 += (CString)*temp1 + L"|";
		temp1++;
	}
	return cstrResult1;
}
void CTestDlg::OnBnClickedOk()
{
	CDialogEx::OnOK();
}


void CTestDlg::OnBnClickedbtnclearall()
{
	//清空所有内容
	CString value;
	SetDlgItemText(editorParam1, value);
	SetDlgItemText(editorParam2, value);
	SetDlgItemText(editorParam3, value);
	SetDlgItemText(editorParam4, value);
	SetDlgItemText(editorParam5, value);
	SetDlgItemText(editorParam6, value);
	SetDlgItemText(editorParam7, value);
	SetDlgItemText(editorParam8, value);
	SetDlgItemText(editorParam9, value);
	SetDlgItemText(editorParam10, value);
	SetDlgItemText(editorParam11, value);
	SetDlgItemText(editorParam12, value);
	SetDlgItemText(editorParam13, value);
	SetDlgItemText(editorParam14, value);
	SetDlgItemText(editorResult, value);
	SetDlgItemText(editTest, value);
}
void CTestDlg::SetButtonName(vector<LPCTSTR> vectName)
{
	for (int n = 0; n < vectName.size(); n++)
	{
		GetDlgItem(20000 + n + 1)->SetWindowText(vectName[n]);
	}
}
void CTestDlg::SetButtonVisible(int nShowNum)
{
	for (int n = 1; n <= nShowNum; n++)
	{
		GetDlgItem(20000 + n)->ShowWindow(SW_SHOW);
	}
	for (int n = nShowNum + 1; n <= 14; n++)
	{
		GetDlgItem(20000 + n)->ShowWindow(SW_HIDE);
	}
}
void CTestDlg::SetButtonsState(bool bEnable)
{
	GetDlgItem(btn1)->EnableWindow(bEnable);
	GetDlgItem(btn2)->EnableWindow(bEnable);
	GetDlgItem(btn3)->EnableWindow(bEnable);
	GetDlgItem(btn4)->EnableWindow(bEnable);
	GetDlgItem(btn5)->EnableWindow(bEnable);
	GetDlgItem(btn6)->EnableWindow(bEnable);
	GetDlgItem(btn7)->EnableWindow(bEnable);
	GetDlgItem(btn8)->EnableWindow(bEnable);
	GetDlgItem(btn9)->EnableWindow(bEnable);
	GetDlgItem(btn10)->EnableWindow(bEnable);
	GetDlgItem(btn11)->EnableWindow(bEnable);
	GetDlgItem(btn12)->EnableWindow(bEnable);
	GetDlgItem(btn13)->EnableWindow(bEnable);
	GetDlgItem(btn14)->EnableWindow(bEnable);

	GetDlgItem(btnTest)->EnableWindow(bEnable);
}


void CTestDlg::OnBnClickedbtnconnect()
{
	VFAdapter::vfStartLinkWithCAD(1);
	SetButtonsState(true);
}


void CTestDlg::OnBnClickedbtncreatepnt()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString value3;
	GetDlgItemText(editorParam3, value3);

	double dX = _ttof(value1);
	double dY = _ttof(value2);
	double dZ = _ttof(value3);

	//uint64_t id = 0;
	long id = 0;
	VFAdapter::vfCreatePoint(dX, dY, dZ, id);

	CString strID = (CString)to_string(id).c_str();
	SetDlgItemText(editorResult, strID);
}

void CTestDlg::OnBnClickedbtnintercurvecurve()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);

	double dX, dY, dZ;
	const char* lIDResult;
	VFAdapter::vfCurveCurveIntersection(ConvertCStringToConstChar(value1), ConvertCStringToConstChar(value2), dX, dY, dZ, lIDResult);

	CString strX, strY, strZ;
	strX.Format(_T("%lf"), dX);
	strY.Format(_T("%lf"), dY);
	strZ.Format(_T("%lf"), dZ);

	CString strID = (CString)lIDResult;
	SetDlgItemText(editorResult, strX + "," + strY + "," + strZ + "," + strID);
}


void CTestDlg::OnBnClickedbtnintercurveface()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);

	double dX, dY, dZ;
	const char* lIDResult;
	VFAdapter::vfCurveSurfaceIntersection(ConvertCStringToConstChar(value1), ConvertCStringToConstChar(value2), dX, dY, dZ, lIDResult);

	CString strX, strY, strZ;
	strX.Format(_T("%lf"), dX);
	strY.Format(_T("%lf"), dY);
	strZ.Format(_T("%lf"), dZ);

	CString strID = (CString)lIDResult;
	SetDlgItemText(editorResult, strX + "," + strY + "," + strZ + "," + strID);
}


void CTestDlg::OnBnClickedbtnpick()
{
	uint64_t lID;
	wchar_t* wcharMessage = nullptr;
	VFAdapter::SelectSingleByInteractive(VFAdapter::geom_entity_type::vf_geom_any, lID, wcharMessage, false);

	CString strID = (CString)to_string(lID).c_str();
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtnhighlight()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	int nID1 = _ttoi(value1);

	VFAdapter::SelectByTag(nID1);
}


void CTestDlg::OnBnClickedbtnclearhighlight()
{
	VFAdapter::ClearSeletion();
}


void CTestDlg::OnBnClickedbtncurveoffset()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	int nID1 = _ttoi(value1);
	int nID2 = _ttoi(value2);

	CString strDis;
	GetDlgItemText(editorParam3, strDis);
	double dDis = _ttof(strDis);

	uint64_t lIDResult;
	VFAdapter::OffsetCurve(nID1, nID2, dDis, lIDResult);

	CString strID = (CString)to_string(lIDResult).c_str();
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtninterfaceface()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	int nID1 = _ttoi(value1);
	int nID2 = _ttoi(value2);

	const char* lIDResult;
	VFAdapter::vfCreateCurveBySurfaceIntersection(ConvertCStringToConstChar(value1), ConvertCStringToConstChar(value2),lIDResult);

	CString strID = (CString)lIDResult;
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtngettype()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	int nID1 = _ttoi(value1);

	//VFAdapter::geom_entity_type type;
	//VFAdapter::vfGetEntityType((uint64_t)nID1, type);
	std::string stringID = std::to_string(nID1);
	const char* ccID = stringID.c_str();
	char* charType = nullptr;
	charType = new char();
	VFAdapter::vfGetEntityType(ccID, charType);
	uint64_t type = std::stoull(charType);

	CString strID;
	strID.Format(_T("%d"), int(type));
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtnsurfaceoffset()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	int nID1 = _ttoi(value1);

	CString strDis;
	GetDlgItemText(editorParam3, strDis);
	double dDis = _ttof(strDis);

	const char* lIDResult;
	VFAdapter::vfOffsetSurface(ConvertCStringToConstChar(value1), ConvertCStringToConstChar(value2), dDis, lIDResult);

	CString strID = (CString)lIDResult;
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtnloftsurface()
{
	CString value1, value2, value3;
	vector<int> vectID;
	int nSelectIDNum = 0;
	GetDlgItemText(editorParam1, value1);
	if (value1 != "")
	{
		vectID.push_back(_ttoi(value1));
	}
	GetDlgItemText(editorParam2, value2);
	if (value2 != "")
	{
		vectID.push_back(_ttoi(value2));
	}
	GetDlgItemText(editorParam3, value3);
	if (value3 != "")
	{
		vectID.push_back(_ttoi(value3));
	}
	if (vectID.size() < 2)
	{
		return;
	}
	uint64_t* curveIDs = new uint64_t[vectID.size()];
	for (int nIndex = 0; nIndex < vectID.size(); nIndex++)
	{
		curveIDs[nIndex] = (uint64_t)vectID[nIndex];
	}

	uint64_t lIDResult;
	VFAdapter::vfCreateSurfaceByLoft(curveIDs, (int)vectID.size(), lIDResult);

	CString strID = (CString)to_string(lIDResult).c_str();
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtnsurfacemerge()
{
	CString value1, value2, value3;
	vector<int> vectID;
	int nSelectIDNum = 0;
	GetDlgItemText(editorParam1, value1);
	if (value1 != "")
	{
		vectID.push_back(_ttoi(value1));
	}
	GetDlgItemText(editorParam2, value2);
	if (value2 != "")
	{
		vectID.push_back(_ttoi(value2));
	}
	GetDlgItemText(editorParam3, value3);
	if (value3 != "")
	{
		vectID.push_back(_ttoi(value3));
	}
	if (vectID.size() < 2)
	{
		return;
	}
	uint64_t* curveIDs = new uint64_t[vectID.size()];
	for (int nIndex = 0; nIndex < vectID.size(); nIndex++)
	{
		curveIDs[nIndex] = (uint64_t)vectID[nIndex];
	}

	uint64_t lIDResult;
	VFAdapter::vfSurfaceMerge(curveIDs, (int)vectID.size(), lIDResult);

	CString strID = (CString)to_string(lIDResult).c_str();
	SetDlgItemText(editorResult, strID);

}


void CTestDlg::OnBnClickedbtnsurfacedomain()
{
	CString value1, value2, value3;
	vector<int> vectID;
	int nSelectIDNum = 0;
	GetDlgItemText(editorParam1, value1);
	if (value1 != "")
	{
		vectID.push_back(_ttoi(value1));
	}
	GetDlgItemText(editorParam2, value2);
	if (value2 != "")
	{
		vectID.push_back(_ttoi(value2));
	}
	GetDlgItemText(editorParam3, value3);
	if (value3 != "")
	{
		vectID.push_back(_ttoi(value3));
	}
	if (vectID.size() < 2)
	{
		return;
	}
	uint64_t* curveIDs = new uint64_t[vectID.size()];
	for (int nIndex = 0; nIndex < vectID.size(); nIndex++)
	{
		curveIDs[nIndex] = (uint64_t)vectID[nIndex];
	}

	uint64_t lIDResult = 0;
	//VFAdapter::vfCreateSurfaceByFill(curveIDs, vectID.size(), lIDResult);

	CString strID = (CString)to_string(lIDResult).c_str();
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtnsurfacearea()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	int nID1 = _ttoi(value1);

	double dValue = 0;
	VFAdapter::vfSurfaceArea(ConvertCStringToConstChar(value1), dValue);

	CString strValue;
	strValue.Format(_T("%lf"), dValue);
	SetDlgItemText(editorResult, strValue);
}


void CTestDlg::OnBnClickedbtnsurfaceperimeter()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	int nID1 = _ttoi(value1);

	double dValue = 0;
	VFAdapter::vfSurfacePerimeter(ConvertCStringToConstChar(value1), dValue);

	CString strValue;
	strValue.Format(_T("%lf"), dValue);
	SetDlgItemText(editorResult, strValue);
}


void CTestDlg::OnBnClickedbtnsurfaceweight()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	int nID1 = _ttoi(value1);
	CString strDensity;
	GetDlgItemText(editorParam2, strDensity);
	double dDensity = _ttof(strDensity);

	double dValue = 0;
	VFAdapter::vfSurfaceWeight(ConvertCStringToConstChar(value1), dDensity, dValue);

	CString strValue;
	strValue.Format(_T("%lf"), dValue);
	SetDlgItemText(editorResult, strValue);
}


void CTestDlg::OnBnClickedbtnobjectmultiselect()
{
	vector<uint64_t> vectID;
	wchar_t* wcharMessage = nullptr;
	VFAdapter::vfSelectMultiyInteractive(VFAdapter::geom_entity_type::vf_geom_any, vectID, wcharMessage, false);

	CString strIDs;
	for (int nIndex = 0; nIndex < vectID.size(); nIndex++)
	{
		CString strCurID = (CString)to_string(vectID[nIndex]).c_str();
		strIDs += strCurID + _T(";");
	}

	SetDlgItemText(editorResult, strIDs);
}


void CTestDlg::OnBnClickedbtnmirrorcreatesurface()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	int nID1 = _ttoi(value1);
	int nID2 = _ttoi(value2);

	uint64_t lIDResult;
	VFAdapter::vfMirrorSurface(nID1, nID2,true, lIDResult);

	CString strID = (CString)to_string(lIDResult).c_str();
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtncreateedgeonsurface()
{
	CString strX1;
	GetDlgItemText(editorParam1, strX1);
	CString strY1;
	GetDlgItemText(editorParam2, strY1);
	CString strZ1;
	GetDlgItemText(editorParam3, strZ1);
	CString strX2;
	GetDlgItemText(editorParam4, strX2);
	CString strY2;
	GetDlgItemText(editorParam5, strY2);
	CString strZ2;
	GetDlgItemText(editorParam6, strZ2);
	CString strSurfaceID;
	GetDlgItemText(editorParam7, strSurfaceID);

	vector<double> vectDX1;

	CStringArray* arrayStringX1 = GetSplitString(strX1, _T(","));
	CStringArray* arrayStringY1 = GetSplitString(strY1, _T(","));
	CStringArray* arrayStringZ1 = GetSplitString(strZ1, _T(","));
	CStringArray* arrayStringX2 = GetSplitString(strX2, _T(","));
	CStringArray* arrayStringY2 = GetSplitString(strY2, _T(","));
	CStringArray* arrayStringZ2 = GetSplitString(strZ2, _T(","));
	double* dX1 = new double();
	double* dY1 = new double();
	double* dZ1 = new double();
	double* dX2 = new double();
	double* dY2 = new double();
	double* dZ2 = new double();
	int nSize = arrayStringX1->GetSize();
	for (int n = 0; n < nSize; n++)
	{
		dX1[n] = _ttof(arrayStringX1->GetAt(n));
		dY1[n] = _ttof(arrayStringY1->GetAt(n));
		dZ1[n] = _ttof(arrayStringZ1->GetAt(n));
		dX2[n] = _ttof(arrayStringX2->GetAt(n));
		dY2[n] = _ttof(arrayStringY2->GetAt(n));
		dZ2[n] = _ttof(arrayStringZ2->GetAt(n));
	}
	dX1[nSize] = NAN;
	dY1[nSize] = NAN;
	dZ1[nSize] = NAN;
	dX2[nSize] = NAN;
	dY2[nSize] = NAN;
	dZ2[nSize] = NAN;
	const double* cdX1 = dX1;
	const double* cdY1 = dY1;
	const double* cdZ1 = dZ1;
	const double* cdX2 = dX2;
	const double* cdY2 = dY2;
	const double* cdZ2 = dZ2;

	VFAdapter::vfCreateCurveOnSurfaceByTwoPoints(cdX1, cdY1, cdZ1, cdX2, cdY2, cdZ2, ConvertCStringToConstChar(strSurfaceID));

	//CString strID = (CString)lIDResult;
	//SetDlgItemText(editor4, strID);
}


void CTestDlg::OnBnClickedbtnmirrorcreateedge()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	int nID1 = _ttoi(value1);
	int nID2 = _ttoi(value2);

	uint64_t lIDResult;
	VFAdapter::vfMirrorCurve(nID1, nID2, true, lIDResult);

	CString strID = (CString)to_string(lIDResult).c_str();
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtnprojectcreateedge()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	int nID1 = _ttoi(value1);
	int nID2 = _ttoi(value2);

	uint64_t lIDResult;
	VFAdapter::vfCreateCurveByProjection(nID1, nID2, lIDResult);

	CString strID = (CString)to_string(lIDResult).c_str();
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtncreatespline()
{
	CString value1, value2, value3;
	vector<int> vectID;
	int nSelectIDNum = 0;
	GetDlgItemText(editorParam1, value1);
	if (value1 != "")
	{
		vectID.push_back(_ttoi(value1));
	}
	GetDlgItemText(editorParam2, value2);
	if (value2 != "")
	{
		vectID.push_back(_ttoi(value2));
	}
	GetDlgItemText(editorParam3, value3);
	if (value3 != "")
	{
		vectID.push_back(_ttoi(value3));
	}
	if (vectID.size() < 2)
	{
		return;
	}
	uint64_t* curveIDs = new uint64_t[vectID.size()];
	for (int nIndex = 0; nIndex < vectID.size(); nIndex++)
	{
		curveIDs[nIndex] = (uint64_t)vectID[nIndex];
	}

	uint64_t lIDResult;
	VFAdapter::vfCreateSplineCurve(curveIDs, vectID.size(),true, lIDResult);

	CString strID = (CString)to_string(lIDResult).c_str();
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtnsurfacethicken()
{
	// TODO
	CString value1;
	GetDlgItemText(editorParam1, value1);
	int nID1 = _ttoi(value1);

	CString strDis;
	GetDlgItemText(editorParam2, strDis);
	double dDis = _ttof(strDis);

	uint64_t lIDResult;
	VFAdapter::vfCreateBodyWithThickedSurface(nID1, dDis, lIDResult);

	CString strID = (CString)to_string(lIDResult).c_str();
	SetDlgItemText(editorResult, strID);
}

void CTestDlg::OnBnClickedbtnsurfacegravity()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	int nID1 = _ttoi(value1);

	//double* dValue = new double[3];
	double x, y, z = 0;
	VFAdapter::vfCreateGravityOfSurface(ConvertCStringToConstChar(value1), x,y,z);
	CString strX, strY, strZ;
	ConvertRealValueToCString(x, strX);
	ConvertRealValueToCString(y, strY);
	ConvertRealValueToCString(z, strZ);
	SetDlgItemText(editorResult, strX + "," + strY + "," + strZ);
}

void CTestDlg::OnBnClickedbtnpointoncurve()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	int nID1 = _ttoi(value1);
	int nID2 = _ttoi(value2);

	bool bValue = false;
	CString strValue = _T("0");
	VFAdapter::vfTestPointOnCurve(ConvertCStringToConstChar(value1), ConvertCStringToConstChar(value2), bValue);
	if (bValue)
	{
		strValue = _T("1");
	}

	//strValue = _T("true");

	SetDlgItemText(editorResult, strValue);
}


void CTestDlg::OnBnClickedbtnpointonsurface()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	int nID1 = _ttoi(value1);
	int nID2 = _ttoi(value2);

	int nValue = 0;
	CString strValue = _T("0");
	VFAdapter::vfTestPointOnSurface(ConvertCStringToConstChar(value1), ConvertCStringToConstChar(value2), nValue);
	strValue.Format(_T("%d"),nValue);

	SetDlgItemText(editorResult, strValue);
}


void CTestDlg::OnBnClickedButton2()
{
	// TODO: 在此添加控件通知处理程序代码
}
void CTestDlg::OnBnClickedbtncreateaxis()
{
	CString strFaceID, strPointID, strLineID, strStartAngle, strDirAngle, strSegLength, strHandDir;
	GetDlgItemText(editorParam1, strFaceID);
	GetDlgItemText(editorParam2, strPointID);
	GetDlgItemText(editorParam3, strLineID);
	GetDlgItemText(editorParam4, strStartAngle);
	GetDlgItemText(editorParam5, strDirAngle);
	GetDlgItemText(editorParam6, strSegLength);
	GetDlgItemText(editorParam7, strHandDir);

	const char* constCharFaceID = ConvertCStringToConstChar(strFaceID);
	const char* constCharPointID = ConvertCStringToConstChar(strPointID);
	const char* constCharLineID = ConvertCStringToConstChar(strLineID);
	const char* constCharHandDir = ConvertCStringToConstChar(strHandDir);

	double dStartAngle = _ttof(strStartAngle);
	double dDirAngle = _ttof(strDirAngle);
	double dSegLength = _ttof(strSegLength);

	const char* ccStrRosetteID = nullptr;
	const char* ccStrLine1ID= nullptr;
	const char* ccStrLine2ID= nullptr;
	const char* ccStrLine3ID= nullptr;
	const char* ccStrLine4ID= nullptr;
	const char* ccStrLine5ID= nullptr;
	const char* ccStrLine6ID= nullptr;

	VFAdapter::vfCreateRosette(constCharFaceID,
		constCharPointID,
		constCharLineID,
		dStartAngle,
		dDirAngle,
		dSegLength,
		constCharHandDir,
		ccStrRosetteID,
		ccStrLine1ID,
		ccStrLine2ID,
		ccStrLine3ID,
		ccStrLine4ID,
		ccStrLine5ID,
		ccStrLine6ID);
	CString strRosetteID(ccStrRosetteID);
	CString strLine1ID(ccStrLine1ID);
	CString strLine2ID(ccStrLine2ID);
	CString strLine3ID(ccStrLine3ID);
	CString strLine4ID(ccStrLine4ID);
	CString strLine5ID(ccStrLine5ID);
	CString strLine6ID(ccStrLine6ID);

	CString strRes = strRosetteID + "," +
		strLine1ID + "," + 
		strLine2ID + "," + 
		strLine3ID + "," + 
		strLine4ID + "," + 
		strLine5ID + "," + 
		strLine6ID;

	SetDlgItemText(editorResult, strRes);
}
void CTestDlg::OnBnClickedbtndeleteentity()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	VFAdapter::vfRemoveTargetObject(ConvertCStringToConstChar(value1));
}
void CTestDlg::OnBnClickedbtnmultihighlight()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString value3;
	GetDlgItemText(editorParam3, value3);
	vector<CString> vectText;
	vector<const char*> vectStr;
	if (value1 != "")
	{
		vectText.push_back(value1);
	}
	if (value2 != "")
	{
		vectText.push_back(value2);
	}
	if (value3 != "")
	{
		vectText.push_back(value3);
	}

	for (int i = 0; i < vectText.size(); i++)
	{
		//拆分
		CStringArray* arrayString = GetSplitString(vectText[i], _T(","));
		for (int n = 0; n < arrayString->GetSize(); n++)
		{
			vectStr.push_back(ConvertCStringToConstChar(arrayString->GetAt(n)));
		}
	}
	//防止空白崩溃
	if (vectStr.size() == 0)
	{
		return;
	}

	const char** listCStr = new const char* [vectStr.size()];
	for (int n = 0; n < vectStr.size(); n++)
	{
		listCStr[n] = vectStr[n];
	}
	//默认数组后面加nullptr
	listCStr[vectStr.size()] = nullptr;
	VFAdapter::vfChangeLineColorWidthInsertMap(listCStr);
}
void CTestDlg::OnBnClickedbtnmulticancelhighlight()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString value3;
	GetDlgItemText(editorParam3, value3);
	vector<CString> vectText;
	vector<const char*> vectStr;
	if (value1 != "")
	{
		vectText.push_back(value1);
	}
	if (value2 != "")
	{
		vectText.push_back(value2);
	}
	if (value3 != "")
	{
		vectText.push_back(value3);
	}

	for (int i = 0; i < vectText.size(); i++)
	{
		//拆分
		CStringArray* arrayString = GetSplitString(vectText[i], _T(","));
		for (int n = 0; n < arrayString->GetSize(); n++)
		{
			vectStr.push_back(ConvertCStringToConstChar(arrayString->GetAt(n)));
		}
	}

	const char** listCStr = new const char* [vectStr.size()];
	for (int n = 0; n < vectStr.size(); n++)
	{
		listCStr[n] = vectStr[n];
	}
	//默认数组后面加nullptr
	listCStr[vectStr.size()] = nullptr;
	VFAdapter::vfChangeLineColorWidthFromMap(listCStr);
}
void CTestDlg::OnBnClickedbtntypegetid()
{
	CString strType;
	GetDlgItemText(editorParam1, strType);

	char* charIDs = new char();
	const wchar_t* psz = strType.GetString();
	VFAdapter::vfSelectionToID(psz, charIDs);

	CString strID(charIDs);
	SetDlgItemText(editorResult, strID);
}


void CTestDlg::OnBnClickedbtnCurveLength()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);

	double dResult = 0;
	VFAdapter::vfCurveLength(ConvertCStringToConstChar(value1), dResult);
	CString strResult;
	strResult.Format(_T("%lf"), dResult);
	SetDlgItemText(editorResult, strResult);
}
void CTestDlg::OnBnClickedbtnCreatePointByProjection()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);

	const char* ccResult;
	VFAdapter::vfCreatePointByProjection(ConvertCStringToConstChar(value1), ConvertCStringToConstChar(value2), ccResult);

	SetDlgItemText(editorResult, (CString)ccResult);
}
void CTestDlg::OnBnClickedbtnCreateSplitOrTrim()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString strType;
	GetDlgItemText(editorParam3, strType);
	CString strOrientation1;
	GetDlgItemText(editorParam4, strOrientation1);
	CString strOrientation2;
	GetDlgItemText(editorParam5, strOrientation2);

	int nOrientation1 = _ttoi(strOrientation1);
	int nOrientation2 = _ttoi(strOrientation2);

	VFAdapter::vfCreateSplitOrTrim(ConvertCStringToConstChar(value1), 
		ConvertCStringToConstChar(value2), 
		ConvertCStringToConstChar(strType),
		nOrientation1,
		nOrientation2);
}
void CTestDlg::OnBnClickedbtnCreatPointByGeodesicDis()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);

	CString value3;
	GetDlgItemText(editorParam3, value3);
	CString value4;
	GetDlgItemText(editorParam4, value4);
	CString value5;
	GetDlgItemText(editorParam5, value5);
	CString value6;
	GetDlgItemText(editorParam6, value6);

	const char* ccResult;
	VFAdapter::vfCreatPointByGeodesicDis(ConvertCStringToConstChar(value1),
		ConvertCStringToConstChar(value2),
		_ttof(value3),
		_ttof(value4),
		_ttof(value5),
		_ttof(value6),
		ccResult);
	SetDlgItemText(editorResult, (CString)ccResult);
}
void CTestDlg::OnBnClickedbtnGetIntersectCurve()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);

	const char** ccList;
	VFAdapter::vfGetIntersectCurve(ConvertCStringToConstChar(value1), ccList);

	CString cstrResult;
	int i = 0;
	const char** temp = ccList;
	while (!!*temp) {
		cstrResult += (CString)*temp + L",";
		temp++;
	}
	SetDlgItemText(editorResult, cstrResult);
}
void CTestDlg::OnBnClickedbtnGeodesicLengthOfPointToCurve()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString value3;
	GetDlgItemText(editorParam3, value3);

	CString value4;
	GetDlgItemText(editorParam4, value4);
	CString value5;
	GetDlgItemText(editorParam5, value5);
	CString value6;
	GetDlgItemText(editorParam6, value6);

	double dResult;
	VFAdapter::vfGeodesicLengthOfPointToCurve(ConvertCStringToConstChar(value1),
		ConvertCStringToConstChar(value2),
		ConvertCStringToConstChar(value3),
		_ttof(value4),
		_ttof(value5),
		_ttof(value6),
		dResult);

	CString strResult;
	strResult.Format(_T("%lf"), dResult);
	SetDlgItemText(editorResult, strResult);
}
void CTestDlg::OnBnClickedbtnGetUnitTangentVectorAtPoint()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString strType;
	GetDlgItemText(editorParam3, strType);
	CString strOrientation1;
	GetDlgItemText(editorParam4, strOrientation1);
	CString strOrientation2;
	GetDlgItemText(editorParam5, strOrientation2);

	double dResult1, dResult2, dResult3;
	VFAdapter::vfGetUnitTangentVectorAtPoint(ConvertCStringToConstChar(value1),
		ConvertCStringToConstChar(value2),
		_ttoi(strOrientation1),
		dResult1,
		dResult2,
		dResult3);

	CString strResult1;
	strResult1.Format(_T("%lf"), dResult1);
	CString strResult2;
	strResult2.Format(_T("%lf"), dResult2);
	CString strResult3;
	strResult3.Format(_T("%lf"), dResult3);

	SetDlgItemText(editorResult, strResult1 + "," + strResult2 + "," + strResult3);
}
void CTestDlg::OnBnClickedbtnGetUnitNormalVectorAtPoint()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString strOrientation1;
	GetDlgItemText(editorParam3, strOrientation1);
	bool bOn = false;
	if (strOrientation1 == L"true")
	{
		bOn = true;
	}

	double dResult1, dResult2, dResult3;
	VFAdapter::vfGetUnitNormalVectorAtPoint(ConvertCStringToConstChar(value1),
		ConvertCStringToConstChar(value2),
		bOn,
		dResult1,
		dResult2,
		dResult3);

	CString strResult1;
	strResult1.Format(_T("%lf"), dResult1);
	CString strResult2;
	strResult2.Format(_T("%lf"), dResult2);
	CString strResult3;
	strResult3.Format(_T("%lf"), dResult3);

	SetDlgItemText(editorResult, strResult1 + "," + strResult2 + "," + strResult3);
}
void CTestDlg::OnBnClickedbtnGetPointByGeodesicDis2()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString value3;
	GetDlgItemText(editorParam3, value3);
	CString value4;
	GetDlgItemText(editorParam4, value4);
	CString value5;
	GetDlgItemText(editorParam5, value5);
	CString value6;
	GetDlgItemText(editorParam6, value6);
	CString value7;
	GetDlgItemText(editorParam7, value7);
	CString value8;
	GetDlgItemText(editorParam8, value8);

	double dResult1, dResult2, dResult3;
	int* nResult = nullptr;
	VFAdapter::vfGetPointByGeodesicDis(ConvertCStringToConstChar(value1),
		_ttof(value2),
		_ttof(value3),
		_ttof(value4),
		_ttof(value5),
		_ttof(value6),
		_ttof(value7),
		_ttof(value8),
		dResult1,
		dResult2,
		dResult3,
		*nResult);

	CString strResult1;
	strResult1.Format(_T("%lf"), dResult1);
	CString strResult2;
	strResult2.Format(_T("%lf"), dResult2);
	CString strResult3;
	strResult3.Format(_T("%lf"), dResult3);
	CString strResult4;
	if (nResult)
	{
		strResult4.Format(_T("%d"), *nResult);
	}

	SetDlgItemText(editorResult, strResult1 + "," + strResult2 + "," + strResult3 + "," + strResult4);
}
void CTestDlg::OnBnClickedbtnCreatPointByGeodesicDis2()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString value3;
	GetDlgItemText(editorParam3, value3);
	CString value4;
	GetDlgItemText(editorParam4, value4);
	CString value5;
	GetDlgItemText(editorParam5, value5);
	CString value6;
	GetDlgItemText(editorParam6, value6);

	double dResult1, dResult2, dResult3;
	VFAdapter::vfCreatPointByGeodesicDis2(ConvertCStringToConstChar(value1),
		ConvertCStringToConstChar(value2),
		_ttoi(value3),
		_ttoi(value4),
		_ttoi(value5),
		_ttoi(value6),
		dResult1,
		dResult2,
		dResult3);

	CString strResult1;
	strResult1.Format(_T("%lf"), dResult1);
	CString strResult2;
	strResult2.Format(_T("%lf"), dResult2);
	CString strResult3;
	strResult3.Format(_T("%lf"), dResult3);

	SetDlgItemText(editorResult, strResult1 + "," + strResult2 + "," + strResult3);
}
void CTestDlg::OnBnClickedbtnGetCoordOfPoint()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	double dResult1, dResult2, dResult3;
	VFAdapter::vfGetCoordOfPoint(ConvertCStringToConstChar(value1),
		dResult1,
		dResult2,
		dResult3);

	CString strResult1;
	strResult1.Format(_T("%lf"), dResult1);
	CString strResult2;
	strResult2.Format(_T("%lf"), dResult2);
	CString strResult3;
	strResult3.Format(_T("%lf"), dResult3);
	SetDlgItemText(editorResult, strResult1 + "," + strResult2 + "," + strResult3);
}
void CTestDlg::OnBnClickedbtnTestPointOnSurfaceByProject()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString value3;
	GetDlgItemText(editorParam3, value3);
	CString value4;
	GetDlgItemText(editorParam4, value4);
	CString value5;
	GetDlgItemText(editorParam5, value5);
	CString value6;
	GetDlgItemText(editorParam6, value6);
	CString value7;
	GetDlgItemText(editorParam7, value7);
	int nResult;
	VFAdapter::vfTestPointOnSurfaceByProject(ConvertCStringToConstChar(value1),
		_ttof(value2),
		_ttof(value3),
		_ttof(value4),
		_ttof(value5),
		_ttof(value6),
		_ttof(value7),
		nResult);

	CString strResult;
	strResult.Format(_T("%d"), nResult);
	SetDlgItemText(editorResult, strResult);
}
void CTestDlg::OnBnClickedbtnCreateNormalLineAndArrowhead()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);

	VFAdapter::vfCreateNormalLineAndArrowhead(ConvertCStringToConstChar(value1),ConvertCStringToConstChar(value2));
}
void CTestDlg::OnBnClickedbtnDeleteNormalLineAndArrowhead()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	VFAdapter::vfDeleteNormalLineAndArrowhead(ConvertCStringToConstChar(value1));
}
void CTestDlg::OnBnClickedbtnSelectionToIDMore()
{
	CString strType;
	GetDlgItemText(editorParam1, strType);

	char* charIDs = new char();
	const wchar_t* psz = strType.GetString();

	const char** ccList;
	VFAdapter::vfSelectionToIDMore(psz, ccList);

	CString cstrResult;
	int i = 0;
	const char** temp = ccList;
	while (!!*temp) {
		cstrResult += (CString)*temp + L",";
		temp++;
	}
	SetDlgItemText(editorResult, cstrResult);
}
void CTestDlg::OnBnClickedbtnAddCommentOnPoint()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);

	VFAdapter::vfAddCommentOnPoint(ConvertCStringToConstChar(value1), ConvertCStringToConstChar(value2));
}
void CTestDlg::OnBnClickedbtnDeleteCommentOnPoint()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);

	VFAdapter::vfDeleteCommentOnPoint(ConvertCStringToConstChar(value1));
}
void CTestDlg::OnBnClickedbtnChangeSurfaceColorInsertMap()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString value3;
	GetDlgItemText(editorParam3, value3);
	CString value4;
	GetDlgItemText(editorParam4, value4);
	vector<CString> vectText;
	vector<const char*> vectStr;
	//拆分
	CStringArray* arrayString = GetSplitString(value1, _T(","));
	for (int n = 0; n < arrayString->GetSize(); n++)
	{
		vectStr.push_back(ConvertCStringToConstChar(arrayString->GetAt(n)));
	}

	const char** listCStr = new const char* [vectStr.size()];
	for (int n = 0; n < vectStr.size(); n++)
	{
		listCStr[n] = vectStr[n];
	}
	//默认数组后面加nullptr
	listCStr[vectStr.size()] = nullptr;

	int32_t nR = _ttoi(value2);
	int32_t nG = _ttoi(value3);
	int32_t nB = _ttoi(value4);


	const char* lIDResult = nullptr;
	//VFAdapter::vfChangeSurfaceColorInsertMap(listCStr,nR,nG,nB, lIDResult);

	CString strID = (CString)lIDResult;
	SetDlgItemText(editorResult,strID);
}
void CTestDlg::OnBnClickedbtnChangeSurfaceColorFromMap()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);

	//VFAdapter::vfChangeSurfaceColorFromMap(ConvertCStringToConstChar(value1));
}
void CTestDlg::OnBnClickedbtnChangePointColorInsertMap()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	CString value2;
	GetDlgItemText(editorParam2, value2);
	CString value3;
	GetDlgItemText(editorParam3, value3);
	CString value4;
	GetDlgItemText(editorParam4, value4);
	vector<CString> vectText;
	vector<const char*> vectStr;
	//拆分
	CStringArray* arrayString = GetSplitString(value1, _T(","));
	for (int n = 0; n < arrayString->GetSize(); n++)
	{
		vectStr.push_back(ConvertCStringToConstChar(arrayString->GetAt(n)));
	}

	const char** listCStr = new const char* [vectStr.size()];
	for (int n = 0; n < vectStr.size(); n++)
	{
		listCStr[n] = vectStr[n];
	}
	//默认数组后面加nullptr
	listCStr[vectStr.size()] = nullptr;

	int32_t nR = _ttoi(value2);
	int32_t nG = _ttoi(value3);
	int32_t nB = _ttoi(value4);

	VFAdapter::vfChangePointColorInsertMap(listCStr, nR, nG, nB);
}
void CTestDlg::OnBnClickedbtnChangePointColorFromMap()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);
	vector<const char*> vectStr;
	//拆分
	CStringArray* arrayString = GetSplitString(value1, _T(","));
	for (int n = 0; n < arrayString->GetSize(); n++)
	{
		vectStr.push_back(ConvertCStringToConstChar(arrayString->GetAt(n)));
	}

	const char** listCStr = new const char* [vectStr.size()];
	for (int n = 0; n < vectStr.size(); n++)
	{
		listCStr[n] = vectStr[n];
	}
	//默认数组后面加nullptr
	listCStr[vectStr.size()] = nullptr;

	VFAdapter::vfChangePointColorFromMap(listCStr);
}
void CTestDlg::OnBnClickedbtnGetActiveDocumentName()
{
	BSTR bstr;
	VFAdapter::vfGetActiveDocumentName(bstr);

	SetDlgItemText(editorResult, ConvertBSTRToCString(bstr));
}
void CTestDlg::OnBnClickedbtnDismantleCurve()
{
	CString value1;
	GetDlgItemText(editorParam1, value1);

	const char** list1;
	const char** list2;
	int nLength = 0;
	VFAdapter::vfDismantleCurve(ConvertCStringToConstChar(value1), list1, list2, nLength);

	CString cstrResult1;
	const char** temp1 = list1;
	while (!!*temp1) {
		cstrResult1 += (CString)*temp1 + L"|";
		temp1++;
	}
	CString cstrResult2;
	const char** temp2 = list2;
	while (!!*temp2) {
		cstrResult2 += (CString)*temp2 + L"|";
		temp2++;
	}
	CString cstrResult3;
	cstrResult3.Format(_T("%d"), nLength);
	SetDlgItemText(editorResult, cstrResult1 + "," + cstrResult2 + "," + cstrResult3);
}

